package com.hjxr.sysadmin.zsj.service.impl;

import java.util.Date;
import java.util.List;

import com.hjxr.sysadmin.zsj.domain.ZIndustry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hjxr.sysadmin.zsj.mapper.BuildingMapper;
import com.hjxr.sysadmin.zsj.domain.Building;
import com.hjxr.sysadmin.zsj.service.IBuildingService;

/**
 * 楼宇信息Service业务层处理
 *
 * @author xk
 * @date 2021-03-23
 */
@Service
public class BuildingServiceImpl implements IBuildingService
{
    @Autowired
    private BuildingMapper buildingMapper;

    /**
     * 查询楼宇信息
     *
     * @param buildingId 楼宇信息ID
     * @return 楼宇信息
     */
    @Override
    public Building selectBuildingById(Long buildingId)
    {
        return buildingMapper.selectBuildingById(buildingId);
    }

    /**
     * 查询楼宇信息列表
     *
     * @param building 楼宇信息
     * @return 楼宇信息
     */
    @Override
    public List<Building> selectBuildingList(Building building)
    {
        return buildingMapper.selectBuildingList(building);
    }

    /**
     * 新增楼宇信息
     *
     * @param building 楼宇信息
     * @return 结果
     */
    @Override
    public int insertBuilding(Building building)
    {
        building.setModifiedTime(new Date());
        return buildingMapper.insertBuilding(building);
    }

    /**
     * 修改楼宇信息
     *
     * @param building 楼宇信息
     * @return 结果
     */
    @Override
    public int updateBuilding(Building building)
    {
        building.setModifiedTime(new Date());
        return buildingMapper.updateBuilding(building);
    }

    /**
     * 批量删除楼宇信息
     *
     * @param buildingIds 需要删除的楼宇信息ID
     * @return 结果
     */
    @Override
    public int deleteBuildingByIds(Long[] buildingIds)
    {
        return buildingMapper.deleteBuildingByIds(buildingIds);
    }

    /**
     * 删除楼宇信息信息
     *
     * @param buildingId 楼宇信息ID
     * @return 结果
     */
    @Override
    public int deleteBuildingById(Long buildingId)
    {
        return buildingMapper.deleteBuildingById(buildingId);
    }

    /**
     * 查询楼宇主导产业信息
     * @param buildingId
     * @return
     */
    @Override
    public ZIndustry selectIndustryById(Long buildingId) {
        ZIndustry zIndustry = buildingMapper.selectIndustryById(buildingId);
        return zIndustry;
    }

    /**
     * 新增楼宇主导产业信息
     * @param zIndustry
     * @return
     */
    @Override
    public int insertIndustry(ZIndustry zIndustry) {
        zIndustry.setModifiedTime(new Date());
        return buildingMapper.insertIndustry(zIndustry);
    }

    /**
     * 修改楼宇主导产业信息
     * @param zIndustry
     * @return
     */
    @Override
    public int updateIndustry(ZIndustry zIndustry) {
        zIndustry.setModifiedTime(new Date());
        return buildingMapper.updateIndustry(zIndustry);
    }
}
